﻿using System;
using System.Collections.Generic;
using System.Text;

class PalindromeWords
{
    static bool Palindrome(string word)
    {
        for (int index = 0; index < word.Length / 2; index++)
            if (word[index] != word[word.Length - 1 - index])
                return false;
        return true;
    }
    static void Main()
    {
        Console.WriteLine("Enter a sentence:");
        string text = Console.ReadLine();
        string[] words = text.Split(' ');
        List<string> strList = new List<string>();
        foreach (var word in words)
        {
            if (Palindrome(word))
            {
                strList.Add(word);
            }
        }
        Console.WriteLine("All palindrome words in the sentence are:");
        Console.WriteLine();
        for (int index = 0; index < strList.Count; index++)
        {
            Console.WriteLine(strList[index]);
        }
    }
}

